SRCS	:= $(wildcard *.cpp)

CC		= g++
INCPATH	= ../include
CCFLAG	= -I $(INCPATH) -c -g
#LDFLAG = -L../crossbit -lcrossbit -L../g_crossbit -lgcrossbit -L../arch -static
LDFLAG = -L/usr/lib/nvidia -lcuda -L../crossbit -lcrossbit -L../g_crossbit -lgcrossbit -L../polytope -lpolytope -L../arch
#LDSFLAG = -T../script/crossbit.lds -static 
LDSFLAG = -T../script/crossbit.lds 

APP_OBJS = ia322x86.o ia322ptx.o
APP = ia322x86 ia322ptx

all: $(APP_OBJS) $(APP)
	echo "done!"

$(APP_OBJS):%.o:%.cpp
	$(CC) $(CCFLAG) $? -o $@

ia322x86: ../arch/*.a
	$(CC) $@.o $(LDFLAG) -lia32 -lx86 $(LDSFLAG) -o $@

ia322ptx: ../arch/*.a
	$(CC) $@.o $(LDFLAG) -lia32 -lx86 $(LDSFLAG) -o $@

clean:
	rm -rf *.o
	rm $(APP)
